import { MockMethod } from 'vite-plugin-mock';
import { resultPageSuccess } from '../_util';

const goodsList = (() => {
  const result: any[] = [];
  for (let index = 0; index < 20; index++) {
    result.push({
      id: `${index}`,
      account: '商品'+index,
      spec: [{name:'颜色',value:['黑','白']},{name:'尺码',value:['M','L']}],
      skus: [ { "尺码": "M", "颜色": "黑",price:12.03, skuId: 11, goodsId:11 }, { "尺码": "L", "颜色": "黑" }, { "尺码": "L", "颜色": "白" },{ "尺码": "M", "颜色": "白" ,price:22.03, skuId: 22, goodsId:22} ],
      
      email: '@email',
      nickname: '@cname()',
      role: '@first',
      createTime: '@datetime',
      remark: '@cword(10,20)',
      'dept|0-2': 1,
      'status|1': ['0', '1'],
    });
  }
  return result;
})();

export default [
  {
    url: '/mock/shop/getGoodsList',
    timeout: 100,
    method: 'get',
    response: ({ query }) => {
      const { page = 1, pageSize = 20 } = query;
      return resultPageSuccess(page, pageSize, goodsList);
    },
  },
] as MockMethod[];
